import { Redirect } from "react-router";
import asyncComponent from "@/components/asyncComponent";
const routeSelf = [
  {
    path: "/",
    exact: true,
    // component: asyncComponent(() => import("../page/mainPage")),
    render: () => {
      return <Redirect to={"/mainPage/jokes"}></Redirect>;
    },
  },
];

const error404 = {
  component: asyncComponent(() => import("../page/error404")),
};
const files = require.context("../page", true, /\.\/[^/]+\/_route\.js$/);
const otherRouter = files.keys().map((item) => files(item).default);
const routes = [...routeSelf, ...otherRouter, error404];
console.log("🚀routes", routes);

export { routes };
